Server Interaction

  • Representing the FHIR resource server a client connects to.

    This implementation holds on to an Auth instance to handle authentication. It is automatically instantiated with properties from the settings dictionary provided upon Client initalization or from the server’s cabability statement.

    The server’s cabability statement is automatically downloaded the first time it’s needed for various tasks, such as instantiating the Auth instance or validating/executing operations.

    A server manages its own NSURLSession, either with an optional delegate provided via sessionDelegate or simply the system shared session. Subclasses can change this behavior by overriding createDefaultSession or any of the other request-related methods.

    See more

    Declaration

    Swift

    open class Server: FHIROpenServer, OAuth2RequestPerformer
  • Protocol for server objects to be used by FHIRResource and subclasses.

    See more

    Declaration

    Swift

    public protocol FHIRServer
  • A very basic FHIRServer implementation that deals with Open FHIR servers in JSON.

    It knows its base URL, can fetch and hold on to the cabability statement and perform requests and operations.

    These methods are of interest to you when you create a subclass:

    • handlerForRequest(withMethod:resource:): what kind of handler your server wants to use. Returns FHIRJSONRequestHandler.
    • configurableRequest(for:): the SMART framework returns a request that already has an Authorization headers set, if needed.
    See more

    Declaration

    Swift

    open class FHIROpenServer: FHIRMinimalServer
  • A minimal FHIRServer implementation that deals with Open FHIR servers in JSON.

    These methods are of interest to you when you create a subclass:

    • handlerForRequest(withMethod:resource:): what kind of handler your server wants to use. Returns FHIRJSONRequestHandler.
    • configurableRequest(for:): the SMART framework returns a request that already has an Authorization headers set, if needed.
    See more

    Declaration

    Swift

    open class FHIRMinimalServer: FHIRServer
  • Instances of this class can perform searches on a server.

    TODO: needs a refresh!!

    Searches are instantiated from MongoDB-like query constructs, like:

    let srch = Patient.search(["address": "Boston", "gender": "male", "given": ["$exact": "Willis"]])
    

    Then srch.perform() will run the following URL query against the server:

    "Patient?address=Boston&gender=male&given:exact=Willis"
    
    See more

    Declaration

    Swift

    open class FHIRSearch
  • Named operations to be performed against a FHIR REST endpoint.

    See more

    Declaration

    Swift

    open class FHIROperation: CustomStringConvertible
  • The context an operation is to be performed against.

    See more

    Declaration

    Swift

    public enum FHIROperationContext
  • Protocol for different request/response handlers.

    TODO: should add ResponseType associated type as soon as those can be constrained (SE-0142 – Swift 4?).

    See more

    Declaration

    Swift

    public protocol FHIRRequestHandler
  • Base implementation of FHIRRequestHandler.

    See more

    Declaration

    Swift

    open class FHIRBaseRequestHandler: FHIRRequestHandler
  • PRELIMINARY! Prepare and handle a request returning some type of data.

    If you use this as PUT/POST, you are responsible for setting the data property to an appropriate NSData representation. The Accept and Content-Type headers will be set to the contentType property

    See more

    Declaration

    Swift

    open class FHIRDataRequestHandler: FHIRBaseRequestHandler
  • Prepare and handle a request returning JSON data.

    JSON body data can be greated from the resource, if the receiver holds on to one. The header’s content type for PUT and POST will be set to application/fhir+json; charset=utf-8 no matter what.

    See more

    Declaration

    Swift

    open class FHIRJSONRequestHandler: FHIRBaseRequestHandler
  • Encapsulates a server response, which can also indicate that there was no response or not even a request, in which case the error property carries the only useful information.

    See more

    Declaration

    Swift

    public protocol FHIRServerResponse